package me.ezitku.base.extensions

import android.app.Activity
import android.graphics.Color
import android.os.Build
import android.view.View
import android.view.WindowManager

/**
 * Created by yurqi on 2018/4/19.
 * QQ: 906120575 | Wechat : kalip008
 * Tashkin Company
 */
/**
 * android5.0以上版本的状态栏透明
 */
fun Activity.translateStatusOnAndroid5() {
    if (Build.VERSION.SDK_INT >= 21) {
        val window = window
        window.clearFlags(
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                /*or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION*/)
        window.decorView.systemUiVisibility =
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
                        /*View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or*/
                        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        window.statusBarColor = Color.TRANSPARENT

//        window.statusBarColor = Color.BLACK
//        window.navigationBarColor = Color.BLACK
    }
}